<!--
 * @Descripttion: 
 * @version: @ 1.0.0
 * @Author: 朱江洲
 * @Date: 2021-11-23 22:47:07
 * @LastEditors: 朱江洲
 * @LastEditTime: 2022-04-18 15:37:53
-->
<template>
  <div>
    <el-drawer
      title="批次信息"
      :visible.sync="dialog.invoiceShow"
      :direction="direction"
      :with-header="false"
      size="60%"
      :modal="false"
      @close="invoiceClose"
    >
      <div class="head">
        <div class="header">
          <div class="img">
            <div><img src="@/assets/images/icon-people.png" alt="" /></div>
            <div>
              <div class="img-up">发票抬头</div>
              <div class="img-down">{{ drawerData.title }}</div>
            </div>
            <h3></h3>
          </div>
          <div class="btn" v-if="invoiceShow == true">
            <el-button type="primary" size="default" @click="upIncoive">
              上传发票
            </el-button>
            <el-dropdown>
              <el-button class="el-icon-more"></el-button>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item @click.native="exportOne">
                  导出
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
          <div class="btn" v-else>
            <el-button type="primary" size="default" @click="distribution">
              分配
            </el-button>
            <el-button size="default" @click="receive"> 领取 </el-button>
            <el-dropdown>
              <el-button class="el-icon-more"></el-button>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item @click.native="exportOne">
                  导出
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
        </div>
        <div class="footer">
          <div class="information">
            <span>发票内容</span>
            <h4>{{ drawerData.content }}</h4>
          </div>
          <div class="information">
            <span>发票类型</span>
            <h4>{{ drawerData.invoiceType }}</h4>
          </div>
          <div class="information">
            <span>发票金额</span>
            <h4>{{ drawerData.total }}</h4>
          </div>
          <div class="information">
            <span>申请时间</span>
            <h4>{{ drawerData.paymentTime }}</h4>
          </div>
        </div>
      </div>
      <div class="strip"></div>
      <div class="specific">
        <el-tabs v-model="activeName" type="border-card">
          <el-tab-pane label="基本信息" name="first">
            <div class="basics" style="margin-top: 20px">基础信息</div>
            <el-form :model="drawerData">
              <el-form-item label="订单编号：">
                {{ drawerData.orderNumber }}
              </el-form-item>
              <el-form-item label="状态：">
                {{ drawerData.status }}
              </el-form-item>
              <el-form-item label="发票：">
                <span @click="preview" style="color: #1267fa">发票预览</span>
              </el-form-item>
            </el-form>
            <div class="basics" style="margin-top: 80px">系统信息</div>
            <el-form :model="drawerData">
              <el-form-item label="负责人："
                >{{ drawerData.nickName }}
              </el-form-item>
              <el-form-item label="更新时间：">
                {{ drawerData.updateTime }}
              </el-form-item>
            </el-form>
          </el-tab-pane>
          <el-tab-pane label="发票抬头" name="second">
            <div class="basics" style="margin-top: 20px">发票抬头</div>
            <el-form :model="drawerData">
              <el-form-item label="发票抬头：">
                <span v-if="drawerData.invoiceType == '电子发票'">{{
                  drawerData.title
                }}</span>
                <span v-else>{{ drawerData.title }}</span>
              </el-form-item>
              <el-form-item label="纳税人识别号：">
                <span v-if="drawerData.invoiceType == '电子发票'">
                  {{ drawerData.taxNumber }}</span
                >
                <span v-else>{{ drawerData.vatIdentifier }}</span>
              </el-form-item>
              <el-form-item
                label="注册地址："
                v-if="drawerData.invoiceType == '纸质发票'"
              >
                {{ drawerData.vatAddress }}
              </el-form-item>
              <el-form-item
                label="注册电话："
                v-if="drawerData.invoiceType == '纸质发票'"
              >
                {{ drawerData.vatPhone }}
              </el-form-item>
              <el-form-item
                label="开户行名称："
                v-if="drawerData.invoiceType == '纸质发票'"
              >
                {{ drawerData.vatBank }}
              </el-form-item>
              <el-form-item
                label="开户行帐号："
                v-if="drawerData.invoiceType == '纸质发票'"
              >
                {{ drawerData.vatBankAccount }}
              </el-form-item>
            </el-form>
            <div
              class="basics"
              style="margin-top: 80px"
              v-if="drawerData.invoiceType == '纸质发票'"
            >
              地址信息
            </div>
            <el-form
              :model="drawerData"
              v-if="drawerData.invoiceType == '纸质发票'"
            >
              <el-form-item label="收件人：">
                {{ drawerData.addAddressee }}
              </el-form-item>
              <el-form-item label="详细地址：">
                {{ drawerData.addAddress }}
              </el-form-item>
              <el-form-item label="联系电话：">
                {{ drawerData.addPhone }}
              </el-form-item>
            </el-form>
            <div class="basics" style="margin-top: 80px">其他信息</div>
            <el-form :model="drawerData">
              <el-form-item
                label="推送邮箱："
                v-if="drawerData.invoiceType == '电子发票'"
              >
                {{ drawerData.email }}
              </el-form-item>
              <el-form-item label="备注：">
                {{ drawerData.remark }}
              </el-form-item>
            </el-form>
          </el-tab-pane>
          <el-tab-pane label="操作记录" name="third" class="thirdTab">
            <div
              class="operation"
              v-for="(item, index) in Operation"
              :key="index"
            >
              <div class="user">
                <div class="portrait">
                  <img :src="item.avatar" alt="" />
                </div>
                <el-tooltip
                  class="item"
                  effect="dark"
                  :content="item.createBy"
                  placement="top"
                >
                  <div class="name">{{ item.createBy }}</div>
                </el-tooltip>
              </div>
              <div class="record">
                <div class="time">{{ item.createTime }}</div>
                <div class="content">
                  <div>{{ item.content }}</div>
                </div>
              </div>
            </div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </el-drawer>
  </div>
</template>

<script>
import { OperationRecord } from "@/api/currency";
export default {
  props: {
    dialog: {
      type: Object,
      required: true,
    },
    invoiceShow: {
      type: Boolean,
      required: true,
    },
    drawerData: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      Operation: [],
      activeName: "first",
      direction: "rtl",
    };
  },
  created() {
    this.getRecord();
  },
  methods: {
    // 导出
    exportOne() {
      this.$parent.ids = [];
      this.$parent.ids.push(this.drawerData.id);
      this.$parent.exportChioose();
    },
    // 上传发票
    upIncoive() {
      if (this.drawerData.status !== 1) {
        this.$message.info("已开具发票！");
      } else {
        this.$parent.upInvoiceShow = true;
        this.$parent.upForm.title = this.drawerData.title;
        this.$parent.upForm.id = this.drawerData.id;
      }
    },
    // 发票预览
    preview() {
      this.$parent.preImg = this.drawerData.url;
      this.$parent.previewShow = true;
    },
    // 领取
    receive() {
      this.$parent.chargeId = this.drawerData.id;
      this.$parent.Receive();
    },
    // 分配订单
    distribution() {
      this.dialog.distributionShow = true;
      this.$parent.getDistri();
    },
    invoiceClose() {
      this.dialog.invoiceShowEject = false;
    },
    // 获取操作记录
    getRecord() {
      OperationRecord({ columnId: 21, entryId: this.drawerData.id }).then(
        (res) => {
          this.Operation = res.data;
        }
      );
    },
  },
};
</script>

<style lang="less" scoped>
.head {
  padding: 29px;
  width: 100%;
  height: 155px;
  border-bottom: 1px solid #ececec;
  span {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #999999;
  }
  .header {
    display: flex;
    justify-content: space-between;
    .img {
      display: flex;
      transform: translateY(-15px);
      .img-up {
        font-size: 12px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #999999;
      }
      .img-down {
        font-size: 14px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #2b2b2b;
      }
      img {
        width: 40px;
        height: 40px;
        vertical-align: middle;
        margin-right: 12px;
      }
      h3 {
        display: inline-block;
      }
    }
  }
  .footer {
    display: flex;
    .information {
      display: flex;
      flex-direction: column;
      margin-right: 80px;
      h4 {
        font-size: 14px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #2b2b2b;
        margin-top: 12px;
      }
    }
  }
}
.strip {
  width: 100%;
  height: 16px;
  background: #fafafa;
  border: 1px solid #ececec;
  /deep/.el-tabs__nav-scroll {
    background-color: #f5f8fa;
  }
}

/deep/ .el-tab-pane {
  padding-left: 24px;
  height: 75vh;
  overflow: auto;
}
.basics {
  position: relative;
  font-size: 14px;
}
.basics::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 1px;
  width: 3px;
  height: 14px;
  background: #1267fa;
}

.system {
  margin-top: 30px;
  position: relative;
  font-size: 14px;
}
.system::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 1px;
  width: 3px;
  height: 14px;
  background: #1267fa;
}
.basics-information {
  display: flex;
  flex-wrap: wrap;
  .subclass {
    width: 360px;
    margin-top: 30px;
    margin-right: 150px;
    span {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #999999;
      line-height: 14px;
      vertical-align: top;
    }
    img {
      width: 200px;
      height: 200px;
    }
  }
}

.el-dropdown {
  margin-left: 10px;
}
/deep/.el-table__header-wrapper {
  background: #f2f2f2;
}
.operation {
  display: flex;
  .user {
    display: flex;
    .portrait {
      width: 30px;
      height: 30px;
      border-radius: 30px;
      img {
        width: 100%;
        height: 100%;
        border-radius: 30px;
      }
    }
    .name {
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      width: 100px;
      height: 30px;
      line-height: 30px;
      margin-left: 14px;
    }
  }
  .record {
    padding-left: 21px;
    margin-left: 44px;
    border-left: 1px dotted #dbdcdb;
    .time {
      font-size: 14px;
      position: relative;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #999999;
      line-height: 14px;
    }
    .time::before {
      content: "";
      position: absolute;
      left: -27px;
      width: 11px;
      height: 11px;
      background-color: #000;
      transform: rotate(45deg);
    }
    .content {
      padding-top: 10px;
      padding-bottom: 10px;
    }
  }
}
.cell {
  img {
    width: 40px;
    height: 40px;
  }
}
.previewImg {
  img {
    width: 100%;
    height: 100%;
  }
}
.downLoad {
  a {
    color: #1267fa !important;
    font-size: 12px;
  }
}
.el-form {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  .el-form-item {
    width: 40%;
  }
}
</style>